<?php

class ResTag extends Mysql {
	public function __construct() {
		parent::__construct ();
	}
	/**
	 * 根据id查询tag详情
	 * @param unknown_type $id
	 */
	public function queryById($id) {
		//TODO
		$sql = "select * from restag where id=$id;";
		return $this->exec_query($sql);
	}
	
	/**
	 * 查询所有的tagname以及引用的次数num，按sort排序
	 */
	public function query() {
		//TODO
		$sql = "select * from restag;";
		return $this->exec_query($sql);
	}
	/**
	 * 根据id更新一个tag
	 * @param unknown_type $id
	 * @param unknown_type $name
	 * @param unknown_type $sort
	 */
	public function update($id, $name, $sort) {
		//TODO
		$sql = "";
		return $this->exec_update( $sql );
	}
	/**
	 * 添加一个tag
	 * @param unknown_type $name
	 * @param unknown_type $sort
	 */
	public function add($name, $sort) {
		//TODO
		$sql = "";
		return $this->exec_update( $sql );
	}
	
	/**
	 * 删除一个tag
	 * @param $id
	 */
	public function delete($id) {
		$sql = "delete from restag where id = $id;";
		return $this->exec_update ( $sql );
	}
}

?>